<?php

namespace common\widgets\grid;

use Yii;
use yii\i18n\Formatter;

/**
 * The ExcelGridView widget is used to display data in a grid.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class ExcelGridView extends \yii\grid\GridView {

    /**
     * @var array|Formatter the formatter used to format model attribute values into displayable texts.
     * This can be either an instance of [[Formatter]] or an configuration array for creating the [[Formatter]]
     * instance. If this property is not set, the "formatter" application component will be used.
     */
    public $formatterOptions = [
        'nullDisplay' => '',
    ];

    /**
     * @var string the default data column class if the class name is not explicitly specified when configuring a data column.
     * Defaults to 'common\widgets\grid\DataColumn'.
     */
    public $dataColumnClass = '\common\widgets\grid\ExcelDataColumn';

    /**
     * Initializes the grid view.
     * This method will initialize required property values and instantiate [[columns]] objects.
     */
    public function init() {
        parent::init();
        Yii::configure($this->formatter, $this->formatterOptions);
    }

}
